Imports geoframework.Gps.Nmea

Public Class ConnectingAndDisconnectingForm

    Private Sub GpsDevice_SentenceReceived(ByVal sender As Object, ByVal e As NmeaSentenceEventArgs) Handles GpsDevice.SentenceReceived
        ' Put the sentence in the list box
        RawDataListBox.Items.Add(e.Sentence.ToString())
        RawDataListBox.SelectedIndex = RawDataListBox.Items.Count - 1

        ' Keep the list items from growing too large
        If RawDataListBox.Items.Count > 100 Then
            RawDataListBox.Items.RemoveAt(0)
        End If
    End Sub

    Private Sub StartButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StartButton.Click
        ' Begin GPS communications
        GpsDevice.Start()

        ' Enable the stop button, disable the start button
        StopButton.Enabled = True
        StartButton.Enabled = False
    End Sub

    Private Sub StopButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StopButton.Click
        ' Stop GPS communications
        GpsDevice.Stop()

        ' Re-enable the Start button
        StartButton.Enabled = True
        StopButton.Enabled = False
    End Sub

End Class